Received: from mailsun.aber.ac.uk (mailsun.aber.ac.uk [144.124.16.7]) by kantti.helsinki.fi (8.6.9/8.6.5) with SMTP id NAA09116 for <blitz-list@helsinki.fi>; Wed, 18 May 1994 13:46:14 +0300
Received: from athene.dcs.aber.ac.uk by mailsun.aber.ac.uk with SMTP (PP);
Wed, 18 May 1994 11:45:49 +0100
Received: from thorbb by athene.dcs.aber.ac.uk (4.1/aberclient-4.0-cs-1.1)
id AA08844; Wed, 18 May 94 11:45:17 BST
To: s924723@minyos.xx.rmit.edu.au (Son Huu Le)
Cc: blitz-list@helsinki.fi, nlh1@aber.ac.uk
Subject: Re: Reading volume name
In-Reply-To: Your message of "Tue, 17 May 1994 21:31:01 +1000." <9405171131.12355@minyos.xx.rmit.EDU.AU>
Date: Wed, 18 May 1994 11:45:36 +0100
Message-Id: <22200.769257936@mailhost.aber.ac.uk>
From: Nigel Hughes <nlh1@aber.ac.uk>
X-Status:
Status: RO
In message <9405171131.12355@minyos.xx.rmit.EDU.AU>,
s924723@minyos.xx.rmit.EDU.AU (Son Huu Le) writes:
>
> > Hi guys,
> > OK I have a bit of a problem, I want to check all disk drives for a file
> > in their root. So I need all the volume names, easy I say I will just get
> > a DosList from dosextens. So I knock up this routine, compiles fine, I get
> > all type 2's (Volumes) and the correct number of them, however when I try
> > and get the BPTR to the BSTR I get negative values, zeros and when I try
> > and look at the BSTR I get garbage, even if I get a valid address! Why?
>
> ARRRGGGHHHH!!! This almost drove me crazy!! (;
No pun intended, I hope 8)
Thanks man, I was begining to think I was the only one on this list that tries
to do things that are not listed in the manuals!
> The problem was a combination of wrong DosList structure and wrong
> interpretation of BSTR.
Ah ha.
> Firstly, the DosList should contain a C union of three different structures
> (ie. DosListUnion should be either dol_Handler, dol_Volume or dol_AssignList,
> not all three!) The .dt_Volume newtype provides a workaround.
OK I am being stupid.
> Secondly, a BSTR is a BPTR with the first byte containing string length.
> To convert a BPTR to a normal Amiga pointer you must multiply it by 4.
> ie. APTR = BPTR << 2
Yeah, I did try that and still got crap, must have been doing something wrong, again 8)
Ho hum.
> Thirdly, you've got a weird way of accessing newtype structures. (;
Yep, but I types this in from memory when I got here, as I forgot my source 8)